package com.auction.mapper;

import com.auction.dto.OrderPageQueryDTO;
import com.auction.pojo.Order;
import com.auction.vo.OrderVO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface OrderMapper {
    /**
     * 插入订单
     * 
     * @param order
     */
    void insert(Order order);

    /**
     * 更新订单
     * 
     * @param order
     */
    void update(Order order);

    /**
     * 根据ID查询订单
     * 
     * @param id
     * @return
     */
    @Select("SELECT * FROM `order` WHERE id = #{id}")
    Order selectById(@Param("id") Long id);

    /**
     * 获取订单详情
     * 
     * @param id
     * @return
     */
    OrderVO selectVOById(@Param("id") Long id);

    /**
     * 查询买家的订单列表
     * 
     * @param buyerId
     * @param orderStatus
     * @return
     */
    List<OrderVO> selectByBuyerId(@Param("buyerId") Long buyerId, @Param("orderStatus") Integer orderStatus);

    /**
     * 查询卖家的订单列表
     * 
     * @param sellerId
     * @param orderStatus
     * @return
     */
    List<OrderVO> selectBySellerId(@Param("sellerId") Long sellerId, @Param("orderStatus") Integer orderStatus);

    /**
     * 分页查询订单列表
     * @param orderPageQueryDTO
     * @return
     */
    Page<OrderVO> page(OrderPageQueryDTO orderPageQueryDTO);
}